<?php
	include('header.php');
?>
		<!--[if !IE]>start content<![endif]-->
		<div id="content">
			<div class="inner">
				<!--[if !IE]>start section<![endif]-->
				<?php
					$noplate = mysql_real_escape_string($_POST['noplate']);
					$IdTransport = mysql_real_escape_string($_POST['IdTransport']);
					
					if(isset($_POST['kemaskini'])){
						if(empty($_POST['noplate'])){
							$errors[] = 'Please insert plate no.';
						}
						if(is_array($errors)){
							echo"
								<div class='section'>
									<ul class='system_messages'>
									<li class='yellow'><span class='ico'></span>
										<strong class='system_title'>Amaran!</strong>";
							while (list($key,$value) = each($errors))
							{
									echo "<br/><span class='system_title'>".$value."</span>";
							}
							echo "	</li>
									</ul>
								</div>";
						}else{
							
							$noplate = strtoupper(mysql_real_escape_string($_POST['noplate'])); 
							
							$updateTrn= "UPDATE  transport set trn_plate_no='$noplate', trn_modified_date=NOW(), trn_modified_by='$_SESSION[log_userlogin_id]' WHERE trn_id = '$IdTransport'";
							$result = $db->sql_query($updateTrn);
							
							if ($result){	
							
								//	Display success																			
								echo'
								<div class="section">
									<ul class="system_messages">
										<li class="green"><span class="ico"></span><strong class="system_title">Transport updated!</strong></li>
									</ul>
								</div>
									';
							}
							
							
						}
					
					}
					$id = mysql_real_escape_string($_GET['id']); 
					/* Get data. */
					$qPengguna= "select * from transport where trn_id = '$id'  ";
					$rTransport= $db->sql_list($qPengguna);
				?>
				<!--[if !IE]>end section<![endif]-->
				
				<!--[if !IE]>start section<![endif]-->
				<div class="section">
					
					<!--[if !IE]>start title wrapper<![endif]-->
					<div class="title_wrapper">
						<span class="title_wrapper_top"></span>
						<div class="title_wrapper_inner">
							<span class="title_wrapper_middle"></span>
							<div class="title_wrapper_content">
								<h2>Update Transport</h2>
							</div>
						</div>
						<span class="title_wrapper_bottom"></span>
					</div>
					<!--[if !IE]>end title wrapper<![endif]-->
					
					<!--[if !IE]>start section content<![endif]-->
					<div class="section_content">
						<span class="section_content_top"></span>
						
						<div class="section_content_inner">
						
						
						<!--[if !IE]>start forms<![endif]-->

						<form action="" method="POST" class="search_form general_form">
							<!--[if !IE]>start fieldset<![endif]-->
							<fieldset>
								<!--[if !IE]>start forms<![endif]-->
								<div class="forms">
								<!--[if !IE]>start row<![endif]-->
								<div class="row">
									<label>Plate No. :</label>
									<div class="inputs">
										<span class="input_wrapper" style="width:300px;"><input name="noplate" class="text" value="<?php echo $rTransport['trn_plate_no']; ?>" type="text" /></span>
									</div>
								</div>
								<!--[if !IE]>end row<![endif]-->
								
								<!--[if !IE]>start row<![endif]-->
								<div class="row">
									<div class="inputs">
										<input name="IdTransport"  class="text" value="<?php  echo $rTransport['trn_id']; ?>" type="hidden"  />
										<span class="button green_button"><span><span>UPDATE</span></span><input name="kemaskini" type="submit" /></span>
										</div>
								</div>
								<!--[if !IE]>end row<![endif]-->
								
								
								
								</div>
								<!--[if !IE]>end forms<![endif]-->
								
								</fieldset>
							<!--[if !IE]>end fieldset<![endif]-->
						</form>
						
						<!--[if !IE]>end forms<![endif]-->
						
						</div>
						
						<span class="section_content_bottom"></span>
					</div>
					<!--[if !IE]>end section content<![endif]-->
				</div>
				<!--[if !IE]>end section<![endif]-->
				
				
				
				
				
				
					
				
			</div>
		</div>
		<!--[if !IE]>end content<![endif]-->

<?php
	include('footer.php');
?>